<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
		<title>投教助手</title>
		<link rel="stylesheet" href="https://at.alicdn.com/t/font_1019767_k8gb4a34jpl.css">
		<link rel="stylesheet" href="css/common.css">
		<link rel="stylesheet" href="css/calendar.css">
		<link rel="stylesheet" href="css/index.css">
	</head>
	<body>
		<div class="containerBox">
			<div id="calendar">
				<header class="header">
					<ul>
						<li class="cur">月</li>
						<li>年</li>
					</ul>
				</header>
				<div class="container">
					<div id="renderMonth" class="render render-show">
						<div id="control">
							<i class="btn btn-prev iconfont icon-weibiaoti--6"></i>
							<h2 class="title">2019年1月</h2>
							<i class="btn btn-next iconfont icon-weibiaoti--14"></i>
							<input type="button" value="今日" class="today">
						</div>
						<ul class="week">
							<li>周日</li>
							<li>周一</li>
							<li>周二</li>
							<li>周三</li>
							<li>周四</li>
							<li>周五</li>
							<li>周六</li>
						</ul>
						<ul class="day"></ul>
					</div>
					<div id="renderFullYear" class="render">
						<div class="title">
							<h2>2017年</h2>
							<p>
								<span class="lunar-year"><i></i>丁酉鸡年</span>
								<span class="info"><i></i>农历初一</span>
							</p>
						</div>
						<ul class="month"></ul>
					</div>
					<div id="popup" class="popup-left">
						<h3 class="title">七夕节</h3>
						<p class="date">2017年8月28日</p>
						<p class="lunar">丁酉鸡年</p>
						<i class="iconfont closePop">&#xe624;</i>
					</div>
				</div>
			</div>
			<div class="remarksBox">
				<div class="rkTitle">
					<span>事件备注</span>(<span class="rkNum">2</span>)
				</div>
			</div>
		</div>
		
		<script src="js/jquery-3.2.1.min.js"></script>
		<script type="text/javascript">
			/**农历节日
     		* 前两位代表月份，后两位代表日期     
     		**/
			 var lFestive = {
				'1230':{name:'除夕',desc:'除夕的解释'},
				'0101':{name:'春节',desc:'春节的解释'},
				'0102':{name:'正月初二',desc:'正月初二的解释'},
				'0115':{name:'元宵节',desc:'元宵节的解释'},
				'0505':{name:'端午节',desc:'端午节的解释'},
				'0707':{name:'七夕节',desc:'七夕节的解释'},
				'0715':{name:'中元节',desc:'中元节的解释'},
				'0815':{name:'中秋节',desc:'中秋节的解释'},
				'0909':{name:'重阳节',desc:'重阳节的解释'},
				'1208':{name:'腊八节',desc:'腊八节的解释'},
				'1224':{name:'小年',desc:'小年的解释'}
			};

			/**公历节日
     		* 前两位代表月份，后两位代表日期     
    		 **/
			var cFestive = {
				'0204':{name:'元旦',desc:'元旦的解释'},
				'0305':{name:'雷锋日',desc:'雷锋日的解释'},
				'0308':{name:'妇女节',desc:'妇女节的解释'},
				'0312':{name:'植树节',desc:'植树节的解释'},
				'0401':{name:'愚人节',desc:'愚人节的解释'},
				'0501':{name:'劳动日',desc:'劳动日的解释'},
				'0504':{name:'青年节',desc:'青年节的解释'},
				'0512':{name:'护士节',desc:'护士节的解释'},
				'0601':{name:'儿童节',desc:'儿童节的解释'},
				'0701':{name:'建党节',desc:'建党节的解释'},
				'0801':{name:'建军节',desc:'建军节的解释'},
				'0910':{name:'教师节',desc:'教师节的解释'},
				'1001':{name:'国庆节',desc:'国庆节的解释'},
				'1224':{name:'平安夜',desc:'平安夜的解释'},
				'1225':{name:'圣诞节',desc:'圣诞节的解释'}
			};
			 
			/**
		 	* 前两位代表月份，第三位代表第几个星期，第四位代表星期几，其中0代表星期7
		 	* **/
			 var wFestive = {
				'0520':{name:'母亲节',desc:'母亲节的解释'},
				'0630':{name:'父亲节',desc:'父亲节的解释'},
				'1144':{name:'感恩节',desc:'感恩节的解释'}
			};

			/**
			 * 自定义节日
			 * 一年修改一次
			 * 年月日
			 **/
			var cmFestive = {
				'20190204': {name: '自定义节日1', desc: '自定义节日1的解释'},
				'20190206': {name: '自定义节日2', desc: '自定义节日2的解释'},
				'20190219': {name: '自定义节日3', desc: '自定义节日3的解释'},
				'20190220': {name: '自定义节日4', desc: '自定义节日4的解释'},
				'20190223': {name: '自定义节日5',  desc:'自定义节日5的解释'},
			};
			
			var solarTerm = [
				{name: "小寒", desc: "解释"}, 
				{name: "大寒", desc: "解释"}, 
				{name: "立春", desc: "立春的解释"}, 
				{name: "雨水", desc: "雨水的解释"}, 
				{name: "惊蛰", desc: "解释"}, 
				{name: "春分", desc: "解释"}, 
				{name: "清明", desc: "解释"}, 
				{name: "谷雨", desc: "解释"}, 
				{name: "立夏", desc: "解释"}, 
				{name: "小满", desc: "解释"}, 
				{name: "芒种", desc: "解释"}, 
				{name: "夏至", desc: "解释"}, 
				{name: "小暑", desc: "解释"}, 
				{name: "大暑", desc: "解释"}, 
				{name: "立秋", desc: "解释"}, 
				{name: "处暑", desc: "解释"}, 
				{name: "白露", desc: "解释"}, 
				{name: "秋分", desc: "解释"}, 
				{name: "寒露", desc: "解释"}, 
				{name: "霜降", desc: "解释"}, 
				{name: "立冬", desc: "解释"}, 
				{name: "小雪", desc: "解释"}, 
				{name: "大雪", desc: "解释"}, 
				{name: "冬至", desc: "解释"},
			]

			function getCMFestive(obj){
				var result = [];
				
				for(var attr in obj){
					result.push(getCMFestiveStr(attr, obj[attr]))
				}
				
				return result;
			}
			
			function getCMFestiveStr(key, value){
				var mmdd = key.length > 4 ? key.substr(4) : key.substr(0,4);
				var yyyy = key.length > 4 ? key.substr(0, 4) : '';
				var fesKey = key.length > 4 ? (mmdd + '#' +yyyy) : mmdd;
				return [fesKey, value['name'], value['desc']].join('-');
			}
			
			function padding(num, step){
				num = num + ''
				step = step || 2
				
				while(num.length < step){
					num = '0' + num;
				}
				
				return num;
			}

			function getWFestivalDesc(festivalName){
				var wf = Object.values(wFestive);
				var arr = wf.filter(function(item){ return item.name === festivalName })

				return arr.length ? arr[0].desc : false;
			}
		</script>
		<script src="js/tools.js"></script>
		<script src="js/ChineseCalendar.js"></script>
		<script src="js/calender.js"></script>
	</body>
</html>
